import React, { Fragment } from 'react'
import { StyleSheet } from 'react-native'
import { ScaleS } from 'src/utils/ScreenUtil'
import CustomImage from 'src/components/image/CustomImage'
import { isFastImg, workNatures } from 'src/utils/ConfigUtil'
import PropTypes from 'prop-types'

export default function JobType (props) {
  const { type, isFast } = props
  const typeInt = parseInt(type)
  return (
    <Fragment>
      {typeInt >= 0 && <CustomImage style={styles.tagImg} source={workNatures[typeInt].img}/>}
      {isFast === 1 && <CustomImage style={styles.tagImg} source={isFastImg}/>}
    </Fragment>
  )
}

JobType.propTypes = {
  type: PropTypes.number,
  isFast: PropTypes.number
}
const styles = StyleSheet.create({
  tagImg: {
    marginLeft: ScaleS(4),
    width: ScaleS(18),
    height: ScaleS(21),
    resizeMode: 'cover'
  }
})
